<template>
  <div class="app-container">
    <h1 align="left" style="color: palevioletred;margin-left: 20%;">创建用户</h1>
    <el-form  ref="form" :model="form" label-width="120px" style="width: 60%;margin-left: 20%;"  >
      <el-form-item label="用户名">
        <el-input v-model="form.username" placeholder="请输入用户名" />
      </el-form-item>
     <el-form-item label="手机号">
       <el-input v-model="form.phone" placeholder="请输入手机号" />
     </el-form-item>
     <el-form-item label="QQ邮箱">
       <el-input v-model="form.qqEmail" placeholder="请输入QQ号" />
     </el-form-item>
     <el-form-item label="用户密码">
       <el-input v-model="form.password" placeholder="请输入用户密码" />
     </el-form-item>
     <el-form-item label="确认密码">
       <el-input v-model="form.password2" placeholder="请输入用户密码" />
     </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">创建</el-button>
        <el-button @click="onCancel">取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
  import { getCreateUser} from '@/api/user2'
export default {
  data() {
    return {
      form: {
        goodName: null,
        phone:null,
        qqEmail:null,
        password:null,
        password2:null
      }
    }
  },
  methods: {
    onSubmit() {
      getCreateUser(this.form).then(res=>{
        this.$message({
          message: res.status,
          type: 'success'
        })

      })

    },
    onCancel() {
      this.$message({
        message: 'cancel!',
        type: 'warning'
      })
    }
  }
}
</script>

<style scoped>
.line{
  text-align: center;
}
</style>
